package com.future.lock;

import com.future.config.ZkConfig;
import org.apache.curator.framework.recipes.locks.InterProcessMutex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Description:
 *
 * @author weiruibai.vendor
 * Date: 2022/10/10 15:18
 */
@Service
public class ZKLock {

    private final static String PATH = "/zk_ticket";

    @Autowired
    ZkConfig zkConfig;

    public InterProcessMutex getLock() {
        return new InterProcessMutex(zkConfig.curatorFramework(), PATH);
    }
}
